package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据dishIds获取关联的套餐列表
     * @param ids
     * @return
     */
    List<SetmealDish> getByDishIds(List<Long> ids);

    /**
     * 新增套餐菜品关系
     * @param setmealDishList
     */
    void save(List<SetmealDish> setmealDishList);

    /**
     * 批量删除套餐菜品信息
     * @param ids
     */
    void deleteBatch(List<Long> ids);

    /**
     * 根据setmealId删除对应的套餐菜品信息
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId} ")
    void deleteBySetmealId(Long setmealId);

    /**
     * 插入套餐菜品信息
     * @param setmealDishList
     */
    void inertBatch(List<SetmealDish> setmealDishList);

    /**
     * 根据setmealId获取套餐菜品信息
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getBySetmealId(Long id);
}
